<?php

    @include_once("conn.php");


    $ip = $_SERVER["REMOTE_ADDR"];   // 访问此服务端的 客户端 ip

    if(!($ip=="::1"||$ip=="192.168.61.42")){
        die("请联系管理员");
    }

    $id = $_GET["id"];
    
    $del = "delete from `grade` where id = '$id'";

    mysqli_query($conn,$del);

    $rows = mysqli_affected_rows($conn);

    $msg = array();
    if($rows>0){
        $msg["status"] = true;
        $msg["msg"] = "删除成功";
    }else if($rows == 0){
        $msg["status"] = false;
        $msg["msg"] = "删除失败,不存在该数据";
    }else{
        $msg["status"] = false;
        $msg["msg"] = "删除失败,系统有误,请联系管理员";
        $msg["sql"] = $del;
    }

    echo json_encode($msg);



?>